package com.fun.demo.fun;

import java.text.DecimalFormat;

public class MyDecimalFormat {

    static public void SimgleFormat(String pattem, double value){
        DecimalFormat myFormat = new DecimalFormat(pattem);
        String output = myFormat.format(value);
        System.out.println(value + " " + pattem + " " + output);
    }

    static public void UseApplypattenMethodFormat(String pattem , double value){
        DecimalFormat myFormat = new DecimalFormat();
        myFormat.applyPattern(pattem);
        System.out.println(value + " " + " " + myFormat.format(value));
    }

    public static void main(String args[]) {
        SimgleFormat("###,###,###.###", 123456.789);
        SimgleFormat("00000000.####kg", 123456.789);
        SimgleFormat("\u00A4000000.000", 123.78);//￥
        UseApplypattenMethodFormat("#.###%",0.789);
        UseApplypattenMethodFormat("###.##", 123456.789);
        UseApplypattenMethodFormat("0.00\u2030", 0.789);// 千分符


        SimgleFormat("0.000000E0", 0.123);



    }
}